<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>test</title>
    <script src="../static/js/vue.js"></script>
    <script src="../static/js/jquery-3.3.1.js"></script>
    <script src="../static/js/bootstrap.js"></script>
    <link rel="stylesheet" href="../static/css/bootstrap.css"/>
</head>
<body>
<div id="app">
    <input type="text" v-model="userName">
    <input type="text" v-model="passWord">
    <button @click="login">登陆</button>
    {{message}}
</div>

</body>
<script>
    var app=new Vue({
        el:'#app',
        data:{
            userName:'89921218@qq.com',
            passWord:'1ee04e0b1cb5af7367c80c22e42efd8b',
            result:'',
            message:''
        },
        methods: {
            login: function () {
                var da = {username:app.userName,password:app.passWord};
                debugger;
                $.ajax({
                   url:'/login',
                   method:'post',
                   dataType:"json",
                   data:da,
                   success:function(text){
                       debugger;
                       if(text.data!==null){
                            app.result = text;
                            if(text.success){
                                window.location.href="/success";
                            }else{
                                app.message = text.message;
                            }
                       }
                   }
               });
            }
        }
    })
</script>
</html>